<div class="page-header position-relative">
	<h1>
		Gallery details
	</h1>
	
</div><!--/.page-header-->
<div class="row-fluid">
	<div class="span12">
		<div class="row-fluid">
			<a href="<?php echo Yii::app()->createUrl('store/backend/gallery/edit',array('id' => $gallery)); ?>" class="btn btn-warning" title="Edit Album Infomation">
				<i class='icon-pencil'></i>
				Edit Infomation
			</a>
			<a href="<?php echo Yii::app()->createUrl('store/backend/gallery/upload',array('id' => $gallery)); ?>" class="btn btn-success" title="Upload More Image">
				<i class='icon-cloud-upload'></i>
				Upload More
			</a>
		</div>
		<hr>
	</div>
</div>
<div class="row-fluid">
	<div class="table-header">
		All Images In Album
	</div>
	<table id="sample-table-2" class="table table-striped table-bordered table-hover">
		<thead>
			<tr>
				<th class="center">
					<label>
						<input type="checkbox" />
						<span class="lbl"></span>
					</label>
				</th>
				<th>Image</th>
				<th>Album</th>
				<th class="hidden-480">Album Description</th>

				<th class="hidden-phone">
					<i class="icon-time bigger-110 hidden-phone"></i>
					Created date
				</th>
				<th class="hidden-480">Thumbnails</th>

				<th></th>
			</tr>
		</thead>

		<tbody>
			<?php foreach($items as $value) : ?>
			<tr>
				<td class="center">
					<label>
						<input type="checkbox" />
						<span class="lbl"></span>
					</label>
				</td>

				<td>
					<a href="" data-rel="colorbox" class="ace-thumbnails" title="">
						<img src="<?php echo Yii::app()->baseUrl; ?>/timthumb.php?src=<?php echo Yii::app()->baseUrl; ?>/images/products/<?php echo $value['ItemName'] ?>&h=100&w=100" />
					</a>
				</td>
				<td><?php echo $value['gallery']['GalleryName']; ?></td>
				
				<td class="hidden-480"><?php echo $value['gallery']['Description']; ?></td>
				<td class="hidden-phone"><?php echo date_format(new DateTime($value['gallery']['CreateDate']),'F jS Y'); ?></td>

				<td class="hidden-480">
					<?php if($value['Thumb_nails'] == 1) : ?>
						<span class="label label-success">Yes</span>
					<?php else : ?>
						<span class="label label-default">No</span>
					<?php endif; ?>
				</td>

				<td class="td-actions">
					<div class="hidden-phone visible-desktop action-buttons">

						<a class="red" onclick="delete_image(<?php echo $value['ItemId'] ?>)">
							<i class="icon-trash bigger-130"></i>
						</a>
					</div>

					<div class="hidden-desktop visible-phone">
						<div class="inline position-relative">
							<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
								<i class="icon-caret-down icon-only bigger-120"></i>
							</button>

							<ul class="dropdown-menu dropdown-icon-only dropdown-yellow pull-right dropdown-caret dropdown-close">
								

								<li>
									<a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">
										<span class="red">
											<i class="icon-trash bigger-120"></i>
										</span>
									</a>
								</li>
							</ul>
						</div>
					</div>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
</div>
<script type="text/javascript">
	function delete_image(id){
		var checkstr =  confirm('are you sure you want to delete this?');
		if(checkstr == true){
			$.ajax({
				url: '<?php echo Yii::app()->createUrl("store/backend/gallery/delete_item/");?>',
				type: 'POST',
				dataType: 'json',
				data: {id:id},
				success: function(){
					alert('Success');
					window.location.reload();
				},
				error: function(){
					alert('System busy. Please try again later!!!');
				}
			});
		}else{
			return false;
		}
		
	}
</script>